<%@ page import="com.starrysky.cakestore.entity.Type" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.LinkedHashMap" %>
<%@ page import="java.util.Map" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!--header-->
<div class="header">
    <div class="container">
        <nav class="navbar navbar-default" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <h1 class="navbar-brand"><a  href="index.jsp">Yummy</a></h1>
            </div>
            <!--navbar-header-->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li><a href="index.jsp" class="active">Home</a></li>
<%--                    <%--%>
<%--                        Object obj = application.getAttribute("typeMap");--%>
<%--                        LinkedHashMap<Type, List<Type>> typeMap = (LinkedHashMap<Type, List<Type>>) obj;--%>

<%--                        for(Map.Entry<Type,List<Type>> it :typeMap.entrySet()){--%>
<%--                            Type type = it.getKey();--%>
<%--                            List<Type> list = it.getValue();--%>

<%--                            out.println("<li class=\"dropdown grid\">");--%>
<%--                            out.println("<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">"+type.getName()+"<b class=\"caret\"></b></a>");--%>
<%--                            out.println("<ul class=\"dropdown-menu multi-column columns-4\">");--%>
<%--                            out.println("<div class=\"row\">");--%>
<%--                            out.println("<ul class=\"multi-column-dropdown\">");--%>
<%--                            for(Type child : list){--%>
<%--                                out.println("<li><a class=\"list\" href=\"products.jsp\">"+child.getName()+"</a></li>");--%>
<%--                            }--%>
<%--                            out.println("</ul></div></ul></li>");--%>
<%--                        }--%>
<%--                    %>--%>
                    <c:forEach items="${typeMap.entrySet()}" var="entry">
                        <li class="dropdown grid">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">${entry.key.getName()}<b class="caret"></b></a>
                        <ul class="dropdown-menu multi-column columns-4">
                            <div class="row">
                                <ul class="multi-column-dropdown">
                                    <c:forEach items="${entry.value}" var="child">
                                        <li><a class="list" href="products.jsp">${child.getName()}</a></li>
                                    </c:forEach>
                                </ul>
                            </div>
                        </ul>
                        </li>
                    </c:forEach>
                </ul>
                <!--/.navbar-collapse-->
            </div>
            <!--//navbar-header-->
        </nav>
        <div class="header-info">
            <div class="header-right search-box">
                <a href="#"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></a>
                <div class="search">
                    <form class="navbar-form">
                        <input type="text" class="form-control">
                        <button type="submit" class="btn btn-default" aria-label="Left Align">
                            Search
                        </button>
                    </form>
                </div>
            </div>
            <div class="header-right login">
                <a href="#"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></a>
                <div id="loginBox">
                    <form id="loginForm">
                        <fieldset id="body">
                            <fieldset>
                                <label for="email">Email Address</label>
                                <input type="text" name="email" id="email">
                            </fieldset>
                            <fieldset>
                                <label for="password">Password</label>
                                <input type="password" name="password" id="password">
                            </fieldset>
                            <input type="submit" id="login" value="Sign in">
                            <label for="checkbox"><input type="checkbox" id="checkbox"> <i>Remember me</i></label>
                        </fieldset>
                        <p>New User ? <a class="sign" href="account.jsp">Sign Up</a> <span><a href="#">Forgot your password?</a></span></p>
                    </form>
                </div>
            </div>
            <div class="header-right cart">
                <a href="#"><span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span></a>
                <div class="cart-box">
                    <h4><a href="checkout.jsp">
                        <span class="simpleCart_total"> $0.00 </span> (<span id="simpleCart_quantity" class="simpleCart_quantity"> 0 </span>)
                    </a></h4>
                    <p><a href="javascript:;" class="simpleCart_empty">Empty cart</a></p>
                    <div class="clearfix"> </div>
                </div>
            </div>
            <div class="clearfix"> </div>
        </div>
        <div class="clearfix"> </div>
    </div>
</div>
<!--//header-->
